[contents] [prev] [next] [top] [bottom] (13 out of 17)

Logical Operators

Expressions that return true or false can be grouped into logical expressions using and, or, and not.

expression and expression
expression
or expression
not expression
The and logical expression only evaluates to true if all of the sub-expressions (expression in the syntax) on either side of the and operator also evaluate to true. If any of the sub-expressions evaluates to false, the entire and expression evaluates to false. The and expression is short-circuiting; that is, the expression stops evaluating its sub-expressions after the first false expression is found.

The or logical expression evaluates to true if any of the sub-expressions on either side of the or evaluate to true. The or expression stops evaluating its sub-expressions once the first true expression is found. The or expression only evaluates to false if all of its sub-expressions also evaluate to false.

The not expression negates the value of expression. If expression evaluates to true, the not expression evaluates to false, and vice versa.

((3 + 2) < (4 + 5)) and 1 >= 1
true
"this" < "that" or "penny" > "pound" 
false
not ("feet" = "feet")
false  


This document is part of the ScriptX Language Guide, one of the volumes of the ScriptX Technical Reference Series. ScriptX is developed by the ScriptX Engineering Team at Apple Computer, successor to the Kaleida Engineering Team at Kaleida Labs, Inc.

Copyright 1996 Apple Computer, Inc. All Rights Reserved.